package com.dhnsoft.boot3.rpc.controller;

import com.dhnsoft.boot3.rpc.service.WeatherInterface;
import com.dhnsoft.boot3.rpc.service.WeatherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.client.support.WebClientAdapter;
import org.springframework.web.service.invoker.HttpServiceProxyFactory;
import reactor.core.publisher.Mono;

/**
 * @author dhn
 * @version 1.0
 * @date 2023-09-12 10:05
 * @Desc
 */
@RestController
public class WeatherController {

    @Autowired
    WeatherService weatherService;
    @GetMapping("/weather")
    public Mono<String> weather(String city){
        Mono<String> weather = weatherService.weather(city);
        return weather;
    }


    public Mono<String> getByWebClient(@RequestParam("city") String city){
        Mono<String> weather = weatherService.weather(city);
//        System.out.println("111111111");
        return weather;
    }


}
